﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using ShredTheLog.Common.MVVM;

namespace ShredTheLog.ViewModels
{
    public sealed class ErrorViewModel : ViewModelBase
    {
        public Func<string> MessageFunc { get; private set; }
        public Func<string> DetailsFunc { get; private set; }

        public ErrorViewModel(Func<string> messageFunc, Func<string> detailsFunc)
        {
            Contract.Requires(messageFunc != null);
            Contract.Requires(detailsFunc != null);

            MessageFunc = messageFunc;
            DetailsFunc = detailsFunc;
        }

        public string Message { get { return MessageFunc(); } }
        public string Details { get { return DetailsFunc(); } }
        public bool HasDetails { get { return !String.IsNullOrEmpty(Details); } }
    }
}
